﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.ParkManage;
using LJX.SmartPark.Domain.Student;
using LJX.SmartPark.Service.ParkManage;
using LJX.SmartPark.Service.ParkManage.Jop;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace LJX.SmartPark.WebApi.Controllers.ParkManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "ParkManage")]
    public class ParkManageController : ControllerBase
    {
        private readonly IJobPostingService jobPostingService;

        private readonly ICustomerService _customerService;

        private readonly IVisitorRequestService _visitorRequestService;

        public ParkManageController(IJobPostingService jobPostingService, ICustomerService customerService, IVisitorRequestService visitorRequestService)
        {
            this.jobPostingService = jobPostingService;
            _customerService = customerService;
            _visitorRequestService = visitorRequestService;
        }

        #region 招聘发布

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<JobPosting>> GetJobPostingAsync(jops jop)
        {
            var result = jobPostingService.GetJobPostingAsync(jop);
            return result.Result;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostJobPosting(JobPosting input)
        {
            var result = jobPostingService.PostJobPosting(input);
            return result;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        [HttpDelete]
        public Task<Response<bool>> DeleteJobPostingAsync(JobPosting input)
        {
            var result = jobPostingService.DeleteByIdJobPostingAsync(input);
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutJobPostingAsync(JobPosting input)
        {
            var result = jobPostingService.PutJobPosting(input);

            return result;
        }

        /// <summary>
        /// 修改发布
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutJobPosting1(JobPosting input)
        {
            var result = jobPostingService.PutJobPosting1(input);

            return result;
        }

        /// <summary>
        /// 修改撤销
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutJobPosting2(JobPosting input)
        {
            var result = jobPostingService.PutJobPosting2(input);

            return result;
        }

        #endregion

        #region 智能客服

        [HttpDelete]
        public Task<Response<bool>> DeleteByIdAsync(Customer input)
        {
            var result = _customerService.DeleteByIdAsync(input);
            return result;
        }

        [HttpPost]
        public Task<Response<List<Customer>>> GetCustomer(CustomerForm form)
        {
            var result = _customerService.GetCustomerAsync(form);
            return result;
        }

        [HttpPost]
        public Task<Response<bool>> PostAddCustomer(Customer input)
        {
            var result = _customerService.PostAddCustomer(input);

            return result;
        }

        [HttpPut]
        public Task<Response<bool>> PutUpdateCustomer(Customer input)
        {
            var result = _customerService.PutUpdateCustomer(input);

            return result;
        }

        #endregion

        #region 访客申请

        [HttpPost]
        public Task<Response<List<VisitorRequest>>> GetVisitorRequest(VisitorRequestForm form)
        {
            var result = _visitorRequestService.GetVisitorRequest(form);
            return result;
        }

        [HttpDelete]
        public Task<Response<bool>> DeleteVisitorRequest(VisitorRequest input)
        {
            var result = _visitorRequestService.DeleteVisitorRequest(input);
            return result;
        }

        #endregion
    }
}
